home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / tpfast30.zip / FASTGRP.ASM < prev    next >
Assembly Source File  |  1990-09-26  |  78KB  |  1,308 lines

  1. ;   _______________________________________________________________
  2. ;  |                                                               |
  3. ;  |            Copyright (C) 1989,1990  Steven Lutrov             |
  4. ;  |_______________________________________________________________|____
  5. ;  |                                                               |    |
  6. ;  |  Program Title : FastGrp.Asm                                  |    | ___
  7. ;  |  Author        : Steven Lutrov                                |    |    |
  8. ;  |  Revision      : 2.01                                         |    |    |
  9. ;  |  Date          : 1990-03-16                                   |    |    |
  10. ;  |  Language      : Turbo Assembler                              |    |    |
  11. ;  |                                                               |    |    |
  12. ;  |  Description   : Assembly Functions For Graphics screen       |    |    |
  13. ;  |                : movement and primitive screen management.    |    |    |
  14. ;  |                : Tested on Turbo Pascal 5.0 & 5.5             |    |    |
  15. ;  |                                                               |    |    |
  16. ;  |_______________________________________________________________|    |    |
  17. ;      |                                                                |    |
  18. ;      |________________________________________________________________|    |
  19. ;          |                                                                 |
  20. ;          |_________________________________________________________________|
  21. ;
  22.  
  23.  
  24. Code Segment Word Public
  25.  
  26. Assume Cs:Code,Ds:Data
  27.  
  28.  
  29. Public Screendown,Screenleft,Screenright,Screenup,Fillscreen,Clearpage
  30. Public Drawbox,Copyclear,Swappage,Restorescreen,Savescreen,Scrollx,Scrolly
  31.  
  32. Data    Segment
  33.         Extrn  Video_Buff : Word
  34.         Extrn  Snow_Check : Byte
  35.         Extrn  Errreturn  : Byte
  36. Data    Ends
  37.  
  38.  
  39. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  40. ;Procedure Screendown(Box: Pointer; Var X_Pos,Y_Pos: Byte; X_Num,Y_Pos: Byte);
  41. ;
  42. ;
  43. ;
  44. ;
  45. Screendown Proc Far
  46.                 Push Bp                         ;Preserve Register Bp
  47.                 Mov  Bp,Sp                      ;Set Stack Frame
  48.                 Push Ds                         ;Save Turbo'S Ds
  49.                 Mov  Dx,Video_Buff              ;Grab Video_Buff
  50.                 Push Dx                         ;Save It
  51.                 Les  Di,Dword Ptr[Bp+14]        ;Es:Di Pts To X_Pos
  52.                 Mov  Al,Snow_Check              ;Grab Snow_Check
  53.                 Mov  [Bp+16],Al                 ;Save On Stack
  54.                 Sub  Cx,Cx                      ;
  55.                 Mov  Cl,Es:[Di]                 ;Get Column Position
  56.                 Jcxz Screendf1                  ;Quit If Column Is Zero
  57.                 Dec  Cx                         ;Count From Zero
  58.                 Cmp  Cx,79                      ;In Range?
  59.                 Jna  Screendg1                  ;Jump Ahead If So
  60. Screendf1:      Jmp  Screendm1                  ;Else Quit
  61. Screendg1:      Mov  Ax,[Bp+20]                 ;Segment Of Box
  62.                 Mov  Es,Ax                      ;Load In Es
  63.                 Mov  Di,[Bp+18]                 ;Offset Of Box
  64.                 Mov  Byte Ptr[Bp+7],0           ;Zero Out High Byte
  65.                 Mov  Ax,[Bp+6]                  ;Y_Pos To Ax
  66.                 Dec  Ax                         ;Dec For Test
  67.                 Cmp  Ax,24                      ;In Range?
  68.                 Jna  Screendh1                  ;Jump Ahead If So
  69.                 Jmp  Screendm1                  ;Else Quit Routine
  70. Screendh1:      Inc  Ax                         ;Readjust
  71.                 Mov  Byte Ptr[Bp+9],0           ;Zero Out High Byte
  72.                 Mov  Bx,[Bp+8]                  ;X_Num To Bx
  73.                 Dec  Bx                         ;Dec For Test
  74.                 Cmp  Bx,79                      ;In Range?
  75.                 Jna  Screendi1                  ;Jump Ahead If So
  76.                 Jmp  Screendm1                  ;Else Quit
  77. Screendi1:      Inc  Bx                         ;Readjust
  78.                 Mul  Bl                         ;X_Num Times Y_Pos
  79.                 Shl  Ax,1                       ;Double For Attributes
  80.                 Add  Ax,Di                      ;Offset To End Of Box
  81.                 Mov  [Bp+14],Ax                 ;End Of Box Ptr To Stack
  82.                 Mov  Di,Ax                      ;Pt Es:Di To End Of Box
  83.                 Lds  Si,Dword Ptr[Bp+10]        ;Point Ds:Si To Y_Pos
  84.                 Sub  Ax,Ax                      ;
  85.                 Mov  Al,[Si]                    ;Get Y_Pos Value
  86.                 Dec  Ax                         ;Count From Zero
  87.                 Cmp  Ax,24                      ;In Range?
  88.                 Jna  Screendk1                  ;Jump Ahead If So
  89. Screendj1:      Jmp  Screendm1                  ;Else Quit
  90. Screendk1:      Mov  Bx,Ax                      ;Copy In Bx
  91.                 Add  Bx,[Bp+6]                  ;Add Y_Pos
  92.                 Cmp  Bx,24                      ;Edge Of Screen?
  93.                 Ja   Screendj1                  ;Quit If So
  94.                 Add  Ax,2                       ;Inc Old Y_Pos Value
  95.                 Mov  [Si],Al                    ;Reset Y_Pos Variable
  96.                 Sub  Ax,2                       ;Back To Old Value
  97.                 Mov  Bl,160                     ;Bytes Per Y_Pos
  98.                 Mul  Bl                         ;Calculate Y_Pos Offset
  99.                 Shl  Cx,1                       ;X_Pos Offset
  100.                 Add  Ax,Cx                      ;Add To Y_Pos Offset
  101.                 Mov  Si,Ax                      ;Si Pts To Topleft Corner
  102.                 Mov  [Bp+12],Si                 ;Save On Stack
  103.                 Mov  Ax,Dx                      ;Video_Buff
  104.                 Mov  Ds,Ax                      ;Move To Ds
  105.                 Mov  Ax,[Bp+6]                  ;Y_Pos
  106.                 Mov  Cl,160                     ;Bytes Per Y_Pos
  107.                 Mul  Cl                         ;Times Y_Pos
  108.                 Add  Si,Ax                      ;Ds:Si Pts To Topright
  109.                 Mov  [Bp+10],Si                 ;Copy Position On Stack
  110.                 Pop  Bx                         ;Video_Buff
  111.                 Cld                             ;Set Direction
  112.                 Mov  Cx,[Bp+8]                  ;X_Num
  113.                 Shl  Cx,1                       ;Double For Attributes
  114.                 Call Boxd_Screen                ;Write A Char
  115.                 Mov  Ax,Ds                      ;Ds To Ax
  116.                 Mov  Es,Ax                      ;Now Es Pts To Screen Too
  117.                 Mov  Di,[Bp+10]                 ;New Bottom Right Pos
  118.                 Mov  Si,Di                      ;Copy To Si
  119.                 Sub  Si,160                     ;Si One Y_Pos Higher
  120.                 Mov  Ax,[Bp+6]                  ;Y_Pos To Ax
  121. Screendl1:      Mov  Cx,[Bp+8]                  ;X_Num To Cx
  122.                 Push Di                         ;Save Target Ptr
  123.                 Push Si                         ;Save Source Ptr
  124.                 Shl  Cx,1                       ;Dbl X_Num For Attributes
  125.                 Call Boxd_Screen                ;Write A Char
  126.                 Pop  Si                         ;Restore Ptr
  127.                 Pop  Di                         ;Restore Ptr
  128.                 Sub  Di,160                     ;Ptr Up One Y_Pos
  129.                 Sub  Si,160                     ;Ditto
  130.                 Dec  Ax                         ;Dec Y_Pos Counter
  131.                 Jnz  Screendl1                  ;Loop Till Finished
  132.                 Mov  Ax,[Bp+20]                 ;Segment Of Box
  133.                 Mov  Ds,Ax                      ;Move To Ds
  134.                 Mov  Si,[Bp+18]                 ;Offset Of Box
  135.                 Mov  Di,[Bp+12]                 ;Es:Di Pts To Topleft
  136.                 Mov  Dx,[Bp+8]                  ;X_Num
  137.                 Shl  Dx,1                       ;Double For Attributes
  138.                 Mov  Cx,Dx                      ;Use As Counter
  139.                 Call Boxd_Screen                ;Write A Char
  140.                 Mov  Ax,Ds                      ;Ds Pts To Box
  141.                 Mov  Es,Ax                      ;Now Es Does Too
  142.                 Mov  Di,[Bp+18]                 ;Offset To Start Of Box
  143.                 Mov  Si,Di                      ;Copy To Si
  144.                 Add  Si,Dx                      ;Offset To Second Y_Pos
  145.                 Mov  Ax,[Bp+6]                  ;Y_Pos
  146.                 Mov  Cx,[Bp+8]                  ;X_Num
  147.                 Mul  Cl                         ;Size Of Box
  148.                 Mov  Cx,Ax                      ;Move To Cx As Counter
  149.                 Rep  Movsw                      ;Shift All Upwards
  150.                 Jmp  Short Screendn1            ;Jump To End
  151. Screendm1:      Pop  Bx                         ;Balance Stack If Error
  152. Screendn1:      Sti                             ;Reenable Interrupts
  153.                 Pop  Ds                         ;Restore Ds And Quit
  154.                 Pop  Bp                         ;Restore Bp
  155.                 Ret  16
  156. Screendown Endp
  157.  
  158.  
  159.  
  160. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  161. ;Procedure Screenleft(Box:Pointer; Var X_Pos,Y_Pos: Byte; X_Num,Y_Pos: Byte);
  162. ;
  163. ;
  164. ;
  165. ;
  166. Screenleft Proc Far
  167.                 Push Bp                         ;Preserve Register Bp
  168.                 Mov  Bp,Sp                      ;Set Stack Frame
  169.                 Push Ds                         ;Save Turbo'S Ds
  170.                 Mov  Dx,Video_Buff              ;Grab Video_Buff
  171.                 Push Dx                         ;Save It
  172.                 Les  Di,Dword Ptr[Bp+14]        ;Es:Di Pts To X_Pos
  173.                 Mov  Al,Snow_Check              ;Grab Snow_Check
  174.                 Mov  [Bp+16],Al                 ;Save On Stack
  175.                 Sub  Cx,Cx                      ;
  176.                 Mov  Cl,Es:[Di]                 ;Get Column Position
  177.                 Jcxz Screenlj1                  ;Quit If Column Is Zero
  178.                 Dec  Cx                         ;Count From Zero
  179.                 Cmp  Cx,79                      ;In Range?
  180.                 Jna  Screenli1                  ;Jump Ahead If So
  181.                 Jmp  Screenlt1                  ;Else Quit
  182. Screenli1:      Cmp  Cx,2                       ;Not On Left Edge?
  183.                 Jnb  Screenlk1                  ;Jump Ahead If Not
  184. Screenlj1:      Jmp  Screenlt1                  ;Else Quit Routine
  185. Screenlk1:      Dec  Cx                         ;Old X_Pos Minus 2
  186.                 Mov  Es:[Di],Cl                 ;Change The Setting
  187.                 Inc  Cx                         ;Restore Old X_Pos Pos
  188.                 Mov  Ax,[Bp+20]                 ;Segment Of Box
  189.                 Mov  Es,Ax                      ;Load In Es
  190.                 Mov  Di,[Bp+18]                 ;Offset Of Box
  191.                 Mov  Byte Ptr[Bp+7],0           ;Zero Out High Byte
  192.                 Mov  Ax,[Bp+6]                  ;Y_Pos To Ax
  193.                 Dec  Ax                         ;Dec For Test
  194.                 Cmp  Ax,24                      ;In Range?
  195.                 Jna  Screenll1                  ;Jump Ahead If So
  196.                 Jmp  Screenlt1                  ;Else Quit Routine
  197. Screenll1:      Inc  Ax                         ;Readjust
  198.                 Mov  Byte Ptr[Bp+9],0           ;Zero Out High Byte
  199.                 Mov  Bx,[Bp+8]                  ;X_Num To Bx
  200.                 Dec  Bx                         ;Dec For Test
  201.                 Cmp  Bx,79                      ;In Range?
  202.                 Jna  Screenlm1                  ;Jump Ahead If So
  203.                 Jmp  Screenlt1                  ;Else Quit
  204. Screenlm1:      Inc  Bx                         ;Readjust
  205.                 Mul  Bl                         ;X_Num Times Y_Pos
  206.                 Shl  Ax,1                       ;Double For Attributes
  207.                 Add  Ax,Di                      ;Offset To End Of Box
  208.                 Mov  [Bp+14],Ax                 ;End Of Box Ptr To Stack
  209.                 Mov  Di,Ax                      ;Pt Es:Di To End Of Box
  210.                 Lds  Si,Dword Ptr[Bp+10]        ;Ds:Si Pts To Y_Pos
  211.                 Sub  Ax,Ax                      ;
  212.                 Mov  Al,[Si]                    ;Get Y_Pos Value
  213.                 Dec  Ax                         ;Count From Zero
  214.                 Cmp  Ax,24                      ;In Range?
  215.                 Jna  Screenln1                  ;Jump Ahead If So
  216.                 Jmp  Screenlt1                  ;Else Quit
  217. Screenln1:      Mov  Bl,160                     ;Bytes Per Y_Pos
  218.                 Mul  Bl                         ;Calculate Y_Pos Offset
  219.                 Shl  Cx,1                       ;X_Pos Offset
  220.                 Add  Ax,Cx                      ;Add To Y_Pos Offset
  221.                 Mov  Si,Ax                      ;Si Pts To Topleft Corner
  222.                 Mov  [Bp+12],Si                 ;Save On Stack
  223.                 Mov  Ax,Dx                      ;Video_Buff
  224.                 Mov  Ds,Ax                      ;Move To Ds
  225.                 Mov  Ax,[Bp+8]                  ;X_Num
  226.                 Shl  Ax,1                       ;Double For Attributes
  227.                 Add  Si,Ax                      ;Ds:Si Pts To Topright
  228.                 Mov  [Bp+10],Si                 ;Copy Position On Stack
  229.                 Pop  Bx                         ;Video_Buff
  230.                 Cld                             ;Set Direction
  231.                 Mov  Si,[Bp+12]                 ;Point To Topleft Corner
  232.                 Sub  Si,4                       ;Minus Two Columns
  233.                 Mov  Cx,[Bp+6]                  ;Y_Pos
  234.                 Mov  Dx,Si                      ;Dx Holds Start X_Pos
  235. Screenlo1:      Mov  Si,Dx                      ;Set Start X_Pos
  236.                 Call Boxl_Screen                ;Write A Char
  237.                 Call Boxl_Screen                ;Write Another
  238.                 Add  Dx,160                     ;Forward One Y_Pos
  239.                 Loop Screenlo1                  ;Do Next Y_Pos
  240.                 Mov  Ax,Ds                      ;Ds To Ax
  241.                 Mov  Es,Ax                      ;Now Es Pts To Screen Too
  242.                 Mov  Si,[Bp+12]                 ;Top Left Position
  243.                 Mov  Di,Si                      ;Copy To Di
  244.                 Sub  Di,4                       ;Will Shift Right By 2
  245.                 Mov  Dx,[Bp+6]                  ;Y_Pos
  246.                 Mov  Ax,[Bp+8]                  ;X_Num
  247. Screenlp1:      Mov  Cx,Ax                      ;X_Num To Cx
  248.                 Push Di                         ;Save Target Start
  249.                 Push Si                         ;Save Source Start
  250. Screenlq1:      Call Boxl_Screen                ;Write A Char
  251.                 Loop Screenlq1                  ;Go Do Next
  252.                 Pop  Si                         ;Restore Source Start
  253.                 Pop  Di                         ;Restore Target Start
  254.                 Add  Di,160                     ;Forward Dest Ptr
  255.                 Add  Si,160                     ;Forward Source Ptr
  256.                 Dec  Dx                         ;Dec Y_Pos Counter
  257.                 Jnz  Screenlp1                  ;Loop Till Image Shifted
  258.                 Mov  Ax,[Bp+20]                 ;Segment Of Box
  259.                 Mov  Ds,Ax                      ;Move To Ds
  260.                 Mov  Si,[Bp+18]                 ;Offset Of Box
  261.                 Mov  Di,[Bp+10]                 ;Es:Di Pts To Old Topleft
  262.                 Sub  Di,4                       ;Leftwards By 2 Cols
  263.                 Mov  Cx,[Bp+6]                  ;Y_Pos
  264.                 Mov  Dx,[Bp+8]                  ;X_Num
  265.                 Sub  Dx,2                       ;Minus 2 For 2 Columns
  266.                 Shl  Dx,1                       ;Double For Attributes
  267. Screenlr1:      Add  Si,Dx                      ;Forward Box Ptr
  268.                 Call Boxl_Screen                ;Write A Char
  269.                 Call Boxl_Screen                ;Write Another
  270.                 Add  Di,156                     ;Forward Target Ptr
  271.                 Loop Screenlr1                  ;Do Next Y_Pos
  272.                 Std                             ;Reverse Direction Flag
  273.                 Mov  Ax,Ds                      ;Ds Pts To Box
  274.                 Mov  Es,Ax                      ;Now Es Does Too
  275.                 Mov  Di,[Bp+14]                 ;Offset To End Of Box
  276.                 Dec  Di                         ;Dec Screen Ptr
  277.                 Dec  Di                         ;Again
  278.                 Mov  Si,Di                      ;Copy To Si
  279.                 Sub  Si,4                       ;Source Pos 2 Chars Left
  280.                 Mov  Ax,[Bp+6]                  ;Y_Pos
  281.                 Mov  Cx,[Bp+8]                  ;X_Num
  282.                 Mul  Cl                         ;Size Of Box
  283.                 Mov  Cx,Ax                      ;Move To Cx As Counter
  284.                 Rep  Movsw                      ;Shift All Downwards
  285.                 Mov  Di,[Bp+18]                 ;Offset Of Box
  286.                 Mov  Si,[Bp+14]                 ;Offset Of X_Pos
  287.                 Mov  Cx,[Bp+6]                  ;Y_Pos
  288.                 Cld                             ;Direction Flag Forward
  289. Screenls1:      Movsw                           ;Move First Word Of Two
  290.                 Movsw                           ;Move The Next
  291.                 Add  Di,Dx                      ;Forward Target Ptr
  292.                 Loop Screenls1                  ;Go Move 2 More Chars
  293.                 Jmp  Short Screenlu1            ;Jump To End
  294. Screenlt1:      Pop  Bx                         ;Balance Stack If Error
  295. Screenlu1:      Sti                             ;Reenable Interrupts
  296.                 Pop  Ds                         ;Restore Ds And Quit
  297.                 Pop  Bp                         ;Restore Bp
  298.                 Ret  16
  299. Screenleft Endp
  300.  
  301.  
  302. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  303. ;Procedure Screenright(Box:Pointer; Var X_Pos,Y_Pos: Byte; X_Num,Y_Pos: Byte);
  304. ;
  305. ;
  306. ;
  307. ;
  308. Screenright Proc Far
  309.                 Push Bp                         ;Save Bp
  310.                 Mov  Bp,Sp                      ;Set Stack Frame
  311.                 Push Ds                         ;Save Turbo'S Ds
  312.                 Mov  Dx,Video_Buff              ;Grab Video_Buff
  313.                 Mov  Bl,Snow_Check              ;Grab Snow_Check
  314.                 Push Bx                         ;Save It
  315.                 Les  Di,Dword Ptr[Bp+14]        ;Es:Di Pts To X_Pos
  316.                 Sub  Cx,Cx                      ;
  317.                 Mov  Cl,Es:[Di]                 ;Get Column Position
  318.                 Jcxz Screenrti1                 ;Quit If Column Is Zero
  319.                 Dec  Cx                         ;Count From Zero
  320.                 Mov  Ax,Cx                      ;Copy To Ax
  321.                 Mov  Byte Ptr[Bp+9],0           ;Zero Out High Byte
  322.                 Add  Ax,[Bp+8]                  ;Add X_Num
  323.                 Cmp  Ax,78                      ;In Range?
  324.                 Jna  Screenrtj1                 ;Jump Ahead If So
  325. Screenrti1:     Jmp  Screenrtt1                 ;Else Quit Routine
  326. Screenrtj1:     Add  Cx,3                       ;Add 2 (+ Inc) To X_Pos Pos
  327.                 Mov  Es:[Di],Cl                 ;Change The Setting
  328.                 Sub  Cx,3                       ;Back To Old X_Pos Position
  329.                 Mov  Ax,[Bp+20]                 ;Segment Of Box
  330.                 Mov  Es,Ax                      ;Load In Es
  331.                 Mov  Di,[Bp+18]                 ;Offset Of Box
  332.                 Mov  Byte Ptr[Bp+7],0           ;Zero Out High Byte
  333.                 Mov  Ax,[Bp+6]                  ;Y_Pos To Ax
  334.                 Dec  Ax                         ;Dec For Test
  335.                 Cmp  Ax,24                      ;In Range?
  336.                 Jna  Screenrtk1                 ;Jump Ahead If So
  337.                 Jmp  Screenrtt1                 ;Else Quit Routine
  338. Screenrtk1:     Inc  Ax                         ;Readjust
  339.                 Mov  Bx,[Bp+8]                  ;X_Num To Bx
  340.                 Dec  Bx                         ;Dec For Test
  341.                 Cmp  Bx,79                      ;In Range?
  342.                 Jna  Screenrtl1                 ;Jump Ahead If So
  343.                 Jmp  Screenrtt1                 ;Else Quit
  344. Screenrtl1:     Inc  Bx                         ;Readjust
  345.                 Mul  Bl                         ;X_Num Times Y_Pos
  346.                 Shl  Ax,1                       ;Double For Attributes
  347.                 Add  Ax,Di                      ;Offset To End Of Box
  348.                 Mov  [Bp+14],Ax                 ;End Of Box Ptr To Stack
  349.                 Mov  Di,Ax                      ;Pt Es:Di To End Of Box
  350.                 Lds  Si,Dword Ptr[Bp+10]        ;Ds:Si Pts To Y_Pos
  351.                 Sub  Ax,Ax                      ;
  352.                 Mov  Al,[Si]                    ;Get Y_Pos Value
  353.                 Dec  Ax                         ;Count From Zero
  354.                 Cmp  Ax,24                      ;In Range?
  355.                 Jna  Screenrtm1                 ;Jump Ahead If So
  356.                 Jmp  Screenrtt1                 ;Else Quit
  357. Screenrtm1:     Mov  Bl,160                     ;Bytes Per Y_Pos
  358.                 Mul  Bl                         ;Calculate Y_Pos Offset
  359.                 Shl  Cx,1                       ;X_Pos Offset
  360.                 Add  Ax,Cx                      ;Add To Y_Pos Offset
  361.                 Mov  Si,Ax                      ;Si Pts To Topleft Corner
  362.                 Mov  [Bp+12],Si                 ;Save On Stack
  363.                 Mov  Ax,Dx                      ;Video_Buff
  364.                 Mov  Ds,Ax                      ;Move To Ds
  365.                 Mov  Ax,[Bp+8]                  ;X_Num
  366.                 Shl  Ax,1                       ;Double For Attributes
  367.                 Add  Si,Ax                      ;Ds:Si Pts To Topright
  368.                 Mov  [Bp+10],Si                 ;Copy Position On Stack
  369.                 Pop  Bx                         ;Restore Procedure Ptr
  370.                 Cld                             ;Set Direction
  371.                 Mov  Cx,[Bp+6]                  ;Y_Pos
  372.                 Mov  Dx,Si                      ;Dx Holds Start X_Pos
  373. Screenrtn1:     Mov  Si,Dx                      ;Set Start X_Pos
  374.                 Call Boxr_Screen                ;Write A Char
  375.                 Call Boxr_Screen                ;Write Another
  376.                 Add  Dx,160                     ;Forward One Y_Pos
  377.                 Loop Screenrtn1                 ;Do Next Y_Pos
  378.                 Mov  Ax,Ds                      ;Ds To Ax
  379.                 Mov  Es,Ax                      ;Now Es Pts To Screen Too
  380.                 Mov  Si,[Bp+10]                 ;Top Right Position + 2
  381.                 Sub  Si,2                       ;Minus 2
  382.                 Mov  Di,Si                      ;Copy To Di
  383.                 Add  Di,4                       ;Will Shift Right By 2
  384.                 Std                             ;Reverse Direction Flag
  385.                 Cmp  Ax,0B800H                  ;Graphics Card?
  386.                 Jb   Screenrto1                 ;Jump If Monochrome
  387.                 Inc  Di                         ;Forward Ptr To Start
  388.                 Inc  Si                         ;Other Ptr
  389. Screenrto1:     Mov  Dx,[Bp+6]                  ;Y_Pos
  390.                 Mov  Ax,[Bp+8]                  ;X_Num
  391. Screenrtp1:     Mov  Cx,Ax                      ;X_Num To Cx
  392.                 Push Di                         ;Save Target Start
  393.                 Push Si                         ;Save Source Start
  394. Screenrtq1:     Call Boxr_Screen                ;Write A Char
  395.                 Loop Screenrtq1                 ;Go Do Next
  396.                 Pop  Si                         ;Restore Source Start
  397.                 Pop  Di                         ;Restore Target Start
  398.                 Add  Di,160                     ;Forward Dest Ptr
  399.                 Add  Si,160                     ;Forward Source Ptr
  400.                 Dec  Dx                         ;Dec Y_Pos Counter
  401.                 Jnz  Screenrtp1                 ;Loop Till Image Shifted
  402.                 Cld                             ;Reset Direction Flag
  403.                 Mov  Ax,[Bp+20]                 ;Segment Of Box
  404.                 Mov  Ds,Ax                      ;Move To Ds
  405.                 Mov  Si,[Bp+18]                 ;Offset Of Box
  406.                 Mov  Di,[Bp+12]                 ;Es:Di Pts To Old Topleft
  407.                 Mov  Cx,[Bp+6]                  ;Y_Pos
  408.                 Mov  Dx,[Bp+8]                  ;X_Num
  409.                 Sub  Dx,2                       ;Minus 2 For 2 Columns
  410.                 Shl  Dx,1                       ;Double For Attributes
  411. Screenrtr1:     Call Boxr_Screen                ;Write A Char
  412.                 Call Boxr_Screen                ;Write Another
  413.                 Add  Di,156                     ;Forward Target Ptr
  414.                 Add  Si,Dx                      ;Forward Source Ptr
  415.                 Loop Screenrtr1                 ;Do Next Y_Pos
  416.                 Mov  Ax,[Bp+20]                 ;Segment Of Box
  417.                 Mov  Es,Ax                      ;Move To Es
  418.                 Mov  Di,[Bp+18]                 ;Offset Of Box
  419.                 Mov  Ax,[Bp+16]                 ;Segment Of X_Pos
  420.                 Mov  Ds,Ax                      ;Move To Ds
  421.                 Mov  Si,[Bp+14]                 ;Offset Of X_Pos
  422.                 Add  Di,4                       ;Di To New Start Of Box
  423.                 Mov  Cx,[Bp+6]                  ;Y_Pos
  424. Screenrts1:     Add  Di,Dx                      ;Forward Target Ptr
  425.                 Movsw                           ;Move One Char Of Two
  426.                 Movsw                           ;Move The Next
  427.                 Loop Screenrts1                 ;Go Move 2 More Chars
  428.                 Mov  Di,[Bp+18]                 ;Offset To Start Of Box
  429.                 Mov  Si,Di                      ;Copy To Si
  430.                 Add  Si,4                       ;Si 2 Chars To The Right
  431.                 Mov  Ax,[Bp+6]                  ;Y_Pos
  432.                 Mov  Cx,[Bp+8]                  ;X_Num
  433.                 Mul  Cl                         ;Size Of Box
  434.                 Mov  Cx,Ax                      ;Move To Cx As Counter
  435.                 Rep  Movsw                      ;Shift All Downwards
  436.                 Jmp  Short Screenrtu1           ;Jump To End
  437. Screenrtt1:     Pop  Bx                         ;Balance Stack If Error
  438. Screenrtu1:     Sti                             ;Reenable Interrupts
  439.                 Pop  Ds                         ;Restore Ds And Quit
  440.                 Pop  Bp                         ;Restore Bp
  441.                 Ret  16
  442. Screenright Endp
  443.  
  444.  
  445. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  446. ;Procedure Screenup(Box: Pointer; Var X_Pos,Y_Pos: Byte; X_Num,Y_Pos: Byte);
  447. ;
  448. ;
  449. ;
  450. ;
  451. Screenup Proc Far
  452.                 Push Bp                         ;Save Bp
  453.                 Mov  Bp,Sp                      ;Set Stack Frame
  454.                 Push Ds                         ;Save Turbo'S Ds
  455.                 Mov  Dx,Video_Buff              ;Grab Video_Buff
  456.                 Push Dx                         ;Save It
  457.                 Les  Di,Dword Ptr[Bp+14]        ;Point Es:Di To X_Pos
  458.                 Mov  Al,Snow_Check              ;Grab Snow_Check
  459.                 Mov  [Bp+16],Al                 ;Save On Stack
  460.                 Sub  Cx,Cx                      ;
  461.                 Mov  Cl,Es:[Di]                 ;Get Column Position
  462.                 Jcxz Scrupf1                    ;Quit If Column Is Zero
  463.                 Dec  Cx                         ;Count From Zero
  464.                 Cmp  Cx,79                      ;In Range?
  465.                 Jna  Scrupg1                    ;Jump Ahead If So
  466. Scrupf1:        Jmp  Scrupm1                    ;Else Quit
  467. Scrupg1:        Les  Di,Dword Ptr[Bp+18]        ;Point Es:Di To Byte Array
  468.                 Mov  Byte Ptr[Bp+7],0           ;Zero Out High Byte
  469.                 Mov  Ax,[Bp+6]                  ;Y_Pos To Ax
  470.                 Dec  Ax                         ;Dec For Test
  471.                 Cmp  Ax,24                      ;In Range?
  472.                 Jna  Scruph1                    ;Jump Ahead If So
  473.                 Jmp  Scrupm1                    ;Else Quit Routine
  474. Scruph1:        Inc  Ax                         ;Readjust
  475.                 Mov  Byte Ptr[Bp+9],0           ;Zero Out High Byte
  476.                 Mov  Bx,[Bp+8]                  ;X_Num To Bx
  477.                 Dec  Bx                         ;Dec For Test
  478.                 Cmp  Bx,79                      ;In Range?
  479.                 Jna  Scrupi1                    ;Jump Ahead If So
  480.                 Jmp  Scrupm1                    ;Else Quit
  481. Scrupi1:        Inc  Bx                         ;Readjust
  482.                 Mul  Bl                         ;X_Num Times Y_Pos
  483.                 Shl  Ax,1                       ;Double For Attributes
  484.                 Add  Ax,Di                      ;Offset To End Of Box
  485.                 Mov  [Bp+14],Ax                 ;End Of Box Ptr To Stack
  486.                 Mov  Di,Ax                      ;Pt Es:Di To End Of Box
  487.                 Lds  Si,Dword Ptr[Bp+10]        ;Point Ds:Si To Y_Pos
  488.                 Sub  Ax,Ax                      ;
  489.                 Mov  Al,[Si]                    ;Get Y_Pos Value
  490.                 Cmp  Ax,1                       ;Top Y_Pos Already?
  491.                 Je   Scrupj1                    ;Quit If So
  492.                 Dec  Ax                         ;Count From Zero
  493.                 Cmp  Ax,24                      ;In Range?
  494.                 Jna  Scrupk1                    ;Jump Ahead If So
  495. Scrupj1:        Jmp  Scrupm1                    ;Else Quit
  496. Scrupk1:        Mov  Bx,Ax                      ;Copy In Bx
  497.                 Add  Bx,[Bp+6]                  ;Add Y_Pos
  498.                 Cmp  Bx,25                      ;In Range?
  499.                 Ja   Scrupj1                    ;Quit If So
  500.                 Mov  [Si],Al                    ;Reset Y_Pos Variable
  501.                 Mov  Bl,160                     ;Bytes Per Y_Pos
  502.                 Mul  Bl                         ;Calculate Y_Pos Offset
  503.                 Shl  Cx,1                       ;X_Pos Offset
  504.                 Add  Ax,Cx                      ;Add To Y_Pos Offset
  505.                 Mov  Si,Ax                      ;Si Pts To Topleft Corner
  506.                 Mov  [Bp+12],Si                 ;Save On Stack
  507.                 Mov  Ax,Dx                      ;Video_Buff
  508.                 Mov  Ds,Ax                      ;Move To Ds
  509.                 Mov  Ax,[Bp+6]                  ;Y_Pos
  510.                 Mov  Cl,160                     ;Bytes Per Y_Pos
  511.                 Mul  Cl                         ;Times Y_Pos
  512.                 Add  Si,Ax                      ;Ds:Si Pts To Topright
  513.                 Mov  [Bp+10],Si                 ;Copy Position On Stack
  514.                 Pop  Bx                         ;Video_Buff
  515.                 Cld                             ;Set Direction
  516.                 Mov  Si,[Bp+12]                 ;Topright Position
  517.                 Sub  Si,160                     ;Y_Pos Higher
  518.                 Mov  Cx,[Bp+8]                  ;X_Num
  519.                 Shl  Cx,1                       ;Double For Movsb
  520.                 Call Boxu_Screen                ;Write A Char
  521.                 Mov  Ax,Ds                      ;Ds To Ax
  522.                 Mov  Es,Ax                      ;Now Es Pts To Screen Too
  523.                 Mov  Di,[Bp+12]                 ;Top Left Position
  524.                 Mov  Si,Di                      ;Copy To Si
  525.                 Sub  Di,160                     ;Di One Y_Pos Higher
  526.                 Mov  Ax,[Bp+6]                  ;Y_Pos To Ax
  527. Scrupl1:        Mov  Cx,[Bp+8]                  ;X_Num To Cx
  528.                 Push Di                         ;Save Target Ptr
  529.                 Push Si                         ;Save Source Ptr
  530.                 Shl  Cx,1                       ;Double X_Num For Movsb
  531.                 Call Boxu_Screen                ;Write A Char
  532.                 Pop  Si                         ;Restore Ptr
  533.                 Pop  Di                         ;Restore Ptr
  534.                 Add  Di,160                     ;Ptr Down One Y_Pos
  535.                 Add  Si,160                     ;Ditto
  536.                 Dec  Ax                         ;Dec Y_Pos Counter
  537.                 Jnz  Scrupl1                    ;Loop Till Finished
  538.                 Mov  Ax,[Bp+20]                 ;Segment Of Box
  539.                 Mov  Ds,Ax                      ;Move To Ds
  540.                 Mov  Si,[Bp+14]                 ;Offset Of End Of Box
  541.                 Mov  Di,[Bp+10]                 ;Es:Di Pts To Bottomleft
  542.                 Sub  Di,160                     ;One Y_Pos Higher
  543.                 Mov  Dx,[Bp+8]                  ;X_Num
  544.                 Shl  Dx,1                       ;Double For Attributes
  545.                 Sub  Si,Dx                      ;Ds:Si Pts To Last Y_Pos
  546.                 Mov  Cx,Dx                      ;Use As Counter
  547.                 Call Boxu_Screen                ;Write A Char
  548.                 Std                             ;Reverse Direction Flag
  549.                 Mov  Ax,Ds                      ;Ds Pts To Box
  550.                 Mov  Es,Ax                      ;Now Es Does Too
  551.                 Mov  Di,[Bp+14]                 ;Offset To End Of Box
  552.                 Sub  Di,2                       ;Last Char Of Box
  553.                 Mov  Si,Di                      ;Copy To Si
  554.                 Sub  Si,Dx                      ;Offset To Second Y_Pos
  555.                 Mov  Ax,[Bp+6]                  ;Y_Pos
  556.                 Dec  Ax                         ;Minus One Y_Pos
  557.                 Mov  Cx,[Bp+8]                  ;X_Num
  558.                 Mul  Cl                         ;Size Of Box Minus 1 Y_Pos
  559.                 Mov  Cx,Ax                      ;Move To Cx As Counter
  560.                 Rep  Movsw                      ;Shift All Upwards
  561.                 Mov  Di,[Bp+18]                 ;Offset Of Box
  562.                 Mov  Si,[Bp+14]                 ;End Of Box
  563.                 Mov  Cx,[Bp+8]                  ;X_Num
  564.                 Cld                             ;Direction Flag Forward
  565.                 Rep  Movsw                      ;Move New Data
  566.                 Jmp  Short Scrupn1              ;Jump To End
  567. Scrupm1:        Pop  Bx                         ;Balance Stack If Error
  568. Scrupn1:        Sti                             ;Reenable Interrupts
  569.                 Pop  Ds                         ;Restore Ds
  570.                 Pop  Bp                         ;Restore Bp
  571.                 Ret
  572. Screenup Endp
  573.  
  574.  
  575. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  576. ;Procedure Fillscreen(Ch: Char; X_Pos,Y_Pos,X_Num,Y_Pos,Colour: Byte);
  577. ;
  578. ;
  579. ;
  580. ;
  581. Fillscreen Proc Far
  582.                 Push Bp                         ;Save Bp
  583.                 Mov  Bp,Sp                      ;Set Stack Frame
  584.                 Cld                             ;Set Direction Flag
  585.                 Mov  Ax,Video_Buff              ;Fetch Video_Buff
  586.                 Mov  Es,Ax                      ;Es Pts To Screen
  587.                 Mov  Si,Bx                      ;Procedure Addr To Si
  588.                 Sub  Ax,Ax                      ;
  589.                 Mov  Al,[Bp+12]                 ;Get Y_Pos
  590.                 Dec  Ax                         ;Count From 0
  591.                 Mov  Dl,160                     ;Bytes In A Y_Pos
  592.                 Mul  Dl                         ;Times Y_Pos
  593.                 Sub  Dx,Dx                      ;
  594.                 Mov  Dl,[Bp+14]                 ;Get Column
  595.                 Dec  Dx                         ;Count From 0
  596.                 Shl  Dx,1                       ;Double For Attributes
  597.                 Add  Ax,Dx                      ;Add To Y_Pos Offset
  598.                 Mov  Di,Ax                      ;Es:Di Pts To First Char
  599.                 Sub  Bx,Bx                      ;
  600.                 Mov  Bl,[Bp+10]                 ;X_Num In Bx
  601.                 Or   Bx,Bx                      ;Test For Zero
  602.                 Jz   Fillscrl6                  ;Quit If Zero
  603.                 Sub  Dx,Dx                      ;
  604.                 Mov  Dl,[Bp+8]                  ;Y_Pos In Dx
  605.                 Or   Dx,Dx                      ;Test For Zero
  606.                 Jz   Fillscrl6                  ;Quit If Zero
  607.                 Mov  Al,[Bp+16]                 ;Char In Al
  608.                 Mov  Ah,[Bp+6]                  ;Attribute In Ah
  609. Fillscrl1:      Mov  Cx,Bx                      ;X_Num To Cx As Counter
  610.                 Push Di                         ;Save Starting Point
  611.                 Push Dx                         ;Save Y_Pos Counter
  612. Fillscrl2:      Cmp  Snow_Check,0               ;Protect Against Snow?
  613.                 Je   Fillscrl5                  ;Jump Ahead If Not
  614.                 Mov  Dx,3Dah                    ;Status Byte Address
  615.                 Mov  Si,Ax                      ;Save Ax Contents
  616. Fillscrl3:      In   Al,Dx                      ;Get Status Byte
  617.                 Test Al,1                       ;Test Bit
  618.                 Jnz  Fillscrl3                  ;Loop Till 0
  619.                 Cli                             ;Disable Interrupts
  620. Fillscrl4:      In   Al,Dx                      ;Get Status Byte
  621.                 Test Al,1                       ;Test Bit
  622.                 Jz   Fillscrl4                  ;Loop Till 1
  623.                 Mov  Ax,Si                      ;Restore Ax Contents
  624. Fillscrl5:      Stosw                           ;Write Char And Attribute
  625.                 Loop Fillscrl2                  ;Go Do Next
  626.                 Pop  Dx                         ;Restore Y_Pos Counter
  627.                 Pop  Di                         ;Restore Starting Point
  628.                 Add  Di,160                     ;Forward Ptr One Y_Pos
  629.                 Dec  Dx                         ;Dec Y_Pos Counter
  630.                 Jnz  Fillscrl1                  ;Go Do Next Y_Pos
  631. Fillscrl6:      Sti                             ;Reenable Interrupts
  632.                 Pop  Bp                         ;Restore Bp
  633.                 Ret  12
  634. Fillscreen Endp
  635.  
  636.  
  637. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  638. ;Procedure Clearpage(Pagenumber,Colour: Byte);
  639. ;
  640. ;
  641. Clearpage Proc Far
  642.                 Push Bp                         ;Save Bp
  643.                 Mov  Bp,Sp                      ;Set Stack Frame
  644.                 Mov  Bh,[Bp+8]                  ;Page Number To Bh
  645.                 Mov  Ah,2                       ;Bios Func To Set Cursor
  646.                 Sub  Dx,Dx                      ;Y_Pos And Column Are 0,0
  647.                 Int  10H                        ;Set The Cursor
  648.                 Mov  Ah,9                       ;Bios Write Function
  649.                 Mov  Al,32                      ;Clear With Space Char
  650.                 Mov  Bl,[Bp+6]                  ;Attribute To Bl
  651.                 Mov  Cx,2000                    ;Chars To Write
  652.                 Int  10H                        ;Clear The Page
  653.                 Pop  Bp                         ;Restore Bp
  654.                 Ret  4
  655. Clearpage Endp
  656.  
  657. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  658. ;Procedure Drawbox(Char_X ,Char_Y :Char;X_Pos,Y_Pos,X_Num,Y_Pos,Colour:Byte);
  659. ;
  660. ;
  661. ;
  662. ;
  663. Drawbox Proc  Far
  664.  
  665.                 Push Bp                         ;Save Bp
  666.                 Mov  Errreturn,1                ;1 = Y_Pos Out Of Range
  667.                 Mov  Bp,Sp                      ;Set Up Stack Frame
  668.                 Mov  Al,[Bp+18]                 ;Horz Double Or Single?
  669.                 Je   Drawboxe1                  ;Jump Ahead If So
  670.                 Cmp  Al,'D'                     ;Double Line?
  671.                 Je   Drawboxe1                  ;Jump Ahead If So
  672.                 Mov  Dh,196                     ;Else Single Line
  673. Drawboxe1:      Mov  Al,[Bp+16]                 ;Vert Double Or Single?
  674.                 Mov  Dl,186                     ;Assume Double Line
  675.                 Cmp  Al,'D'                     ;Double Line?
  676.                 Je   Drawboxg1                  ;Jump Ahead If So
  677.                 Cmp  Al,'D'                     ;Double Line?
  678.                 Je   Drawboxg1                  ;Jump Ahead If So
  679.                 Mov  Dl,179                     ;Else Single Line
  680.                 Cmp  Dh,196                     ;Horizontal Single?
  681.                 Jne  Drawboxf1                  ;Jump Ahead If Not
  682.                 Mov  Ax,0Dabfh                  ;Top Sngl Vert, Sngl Horz
  683.                 Mov  Bx,0C0D9H                  ;Bot Sngl Vert, Sngl Horz
  684.                 Jmp  Short Drawboxi1            ;Registers Set
  685. Drawboxf1:      Mov  Ax,0D5B8H                  ;Top Sngl Vert, Dbl Horz
  686.                 Mov  Bx,0D4Beh                  ;Bot Sngl Vert, Dbl Horz
  687.                 Jmp  Short Drawboxi1            ;Registers Set
  688. Drawboxg1:      Cmp  Dh,196                     ;Horizontal Single?
  689.                 Jne  Drawboxh1                  ;Jump Ahead If Not
  690.                 Mov  Ax,0D6B7H                  ;Top Dbl Vert, Sngl Horz
  691.                 Mov  Bx,0D3Bdh                  ;Bot Dbl Vert, Sngl Horz
  692.                 Jmp  Short Drawboxi1            ;Registers Set
  693. Drawboxh1:      Mov  Ax,0C9Bbh                  ;Top Dbl Vert, Dbl Horz
  694.                 Mov  Bx,0C8Bch                  ;Bot Dbl Vert, Dbl Horz
  695. Drawboxi1:      Mov  [Bp+18],Ax                 ;Save Top Corners
  696.                 Mov  [Bp+16],Bx                 ;Save Bottom Corners
  697.                 Mov  Ax,Video_Buff              ;Get Ptr To Video_Buff
  698.                 Mov  Es,Ax                      ;Move To Es
  699.                 Sub  Ax,Ax                      ;
  700.                 Mov  Al,[Bp+12]                 ;Y_Pos To Ax
  701.                 Dec  Ax                         ;Count From 0
  702.                 Cmp  Ax,24                      ;In Range?
  703.                 Jbe  Drawboxj1                  ;Jump Ahead If So
  704.                 Jmp  Drawboxo1                  ;Else Quit Routine
  705. Drawboxj1:      Inc  Errreturn                  ;2 = Column Out Of Range
  706.                 Mov  Cl,160                     ;Bytes In A Y_Pos
  707.                 Mul  Cl                         ;Times Y_Pos
  708.                 Sub  Cx,Cx                      ;
  709.                 Mov  Cl,[Bp+14]                 ;Column To Cx
  710.                 Dec  Cx                         ;Count From 0
  711.                 Cmp  Cx,79                      ;In Range?
  712.                 Jna  Drawboxk1                  ;Jump Ahead If Ok
  713.                 Jmp  Drawboxo1                  ;Else Quit
  714. Drawboxk1:      Inc  Errreturn                  ;3 = X_Num Out Of Range
  715.                 Shl  Cx,1                       ;Double For Attributes
  716.                 Add  Ax,Cx                      ;Buffer Offset
  717.                 Mov  Di,Ax                      ;Es:Di Pts To Offset
  718.                 Sub  Bx,Bx                      ;
  719.                 Mov  Bl,[Bp+10]                 ;X_Num To Bx
  720.                 Dec  Bx                         ;Count From 0
  721.                 Dec  Bx                         ;Ready For Test
  722.                 Cmp  Bx,78                      ;Out Of Range?
  723.                 Ja   Drawboxo1                  ;Quit If So
  724.                 Inc  Errreturn                  ;4 = Y_Pos Out Of Range
  725.                 Inc  Bx                         ;Readjust After Test
  726.                 Shl  Bx,1                       ;Double For Attributes
  727.                 Mov  Ah,[Bp+6]                  ;Attribute To Ah
  728.                 Mov  Al,[Bp+19]                 ;Topleft Corner To Al
  729.                 Call Drawb_Screen               ;Write The Character
  730.                 Add  Di,Bx                      ;Add Offset To Scrn Ptr
  731.                 Mov  Al,[Bp+18]                 ;Topright Corner To Al
  732.                 Call Drawb_Screen               ;Write The Character
  733.                 Sub  Di,Bx                      ;Sub Offset From Scrn Ptr
  734.                 Sub  Cx,Cx                      ;
  735.                 Mov  Cl,[Bp+8]                  ;Get Box Y_Pos
  736.                 Dec  Cx                         ;Minus 2
  737.                 Dec  Cx                         ;  For Corners
  738.                 Cmp  Cx,23                      ;Test Length
  739.                 Ja   Drawboxo1                  ;Quit If Out Of Range
  740.                 Mov  Errreturn,0                ;Else No Error
  741.                 Push Di                         ;Save Initial Position
  742.                 Add  Di,160                     ;Forward Screen Ptr
  743.                 Jcxz Drawboxm1                  ;Jump If No Chr To Write
  744.                 Mov  Al,Dl                      ;Vertical Char To Al
  745. Drawboxl1:      Call Drawb_Screen               ;Write The Character
  746.                 Add  Di,Bx                      ;Add Offset To Scrn Ptr
  747.                 Call Drawb_Screen               ;Write The Character
  748.                 Sub  Di,Bx                      ;Sub Offset From Scrn Ptr
  749.                 Add  Di,160                     ;Forward Screen Ptr
  750.                 Loop Drawboxl1                  ;On To Next Vert Chars
  751. Drawboxm1:      Mov  Al,[Bp+17]                 ;Bottomleft Corner To Al
  752.                 Call Drawb_Screen               ;Write The Character
  753.                 Mov  Al,[Bp+16]                 ;Bottomright Corner To Al
  754.                 Add  Di,Bx                      ;Add Offset To Scrn Ptr
  755.                 Call Drawb_Screen               ;Write The Character
  756.                 Sub  Di,Bx                      ;Sub Offset From Scrn Ptr
  757.                 Mov  Bx,Di                      ;Save Bottom Left Pos
  758.                 Pop  Di                         ;Restore Top Left Pos
  759.                 Mov  Al,Dh                      ;Horizontal Char To Al
  760.                 Sub  Cx,Cx                      ;
  761.                 Mov  Cl,[Bp+10]                 ;Get X_Num
  762.                 Dec  Cx                         ;Minus 2
  763.                 Dec  Cx                         ;  For Corners
  764.                 Jcxz Drawboxo1                  ;Quit If No Chrs To Print
  765.                 Inc  Di                         ;Forward Scrn Ptr
  766.                 Inc  Di                         ;  To 1St Position On Top
  767. Drawboxn1:      Call Drawb_Screen               ;Write The Character
  768.                 Inc  Di                         ;Forward Base Ptr
  769.                 Inc  Di                         ;...Again
  770.                 Inc  Bx                         ;Forward Scrn Ptr
  771.                 Inc  Bx                         ;  For Bottom Line
  772.                 Xchg Di,Bx                      ;Get Ready To Write
  773.                 Call Drawb_Screen               ;Write The Character
  774.                 Xchg Di,Bx                      ;Restore Scrn Ptr
  775.                 Loop Drawboxn1                  ;Go Do Next Char
  776. Drawboxo1:      Sti                             ;Reenable Interrupts
  777.                 Pop  Bp                         ;Restore Bp And Quit
  778.                 Ret  14
  779. Drawbox Endp
  780.  
  781.  
  782. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  783. ;Procedure Copyclear(Box: Pointer; X_Pos,Y_Pos,X_Num,Y_Pos,Colour: Byte);
  784. ;
  785. ;
  786. ;
  787. ;
  788. Copyclear Proc Far
  789.                 Push Bp                         ;Save Bp
  790.                 Mov  Bp,Sp                      ;Set Stack Frame
  791.                 Push Ds                         ;Save Ds
  792.                 Mov  Bl,Snow_Check              ;Grab Snow_Check
  793.                 Mov  Ax,Video_Buff              ;Fetch Video Address
  794.                 Mov  Ds,Ax                      ;Ds Points To Buffer
  795.                 Les  Di,Dword Ptr[Bp+16]        ;Es:Di Pts To Byte Array
  796.                 Sub  Ax,Ax                      ;
  797.                 Mov  Al,[Bp+12]                 ;Y_Pos In Ax
  798.                 Dec  Ax                         ;Count Y_Pos From 0
  799.                 Mov  Dl,160                     ;160 Bytes Per Y_Pos
  800.                 Mul  Dl                         ;Ax Times 160
  801.                 Sub  Dx,Dx                      ;
  802.                 Mov  Dl,[Bp+14]                 ;X_Pos In Dx
  803.                 Dec  Dx                         ;Count Cols From 0
  804.                 Shl  Dx,1                       ;Double For Attributes
  805.                 Add  Ax,Dx                      ;Offset Of Topleft Corner
  806.                 Mov  Dh,[Bp+10]                 ;X_Num In Dh
  807.                 Mov  Dl,[Bp+8]                  ;Y_Pos In Dl
  808.                 Mov  Ch,[Bp+6]                  ;Fill Attribute
  809.                 Mov  Cl,32                      ;Space Char For Fill
  810.                 Mov  Bp,Ax                      ;Scrn Ptr Copy In Bp
  811.                 Mov  Ah,Bl                      ;Move Snow_Check
  812.                 Mov  Bx,Cx                      ;Copy In Bx
  813.                 Sub  Cx,Cx                      ;Clear Loop Counter
  814.                 Cld                             ;Set Direction Flag
  815. Copyclear1:     Mov  Si,Bp                      ;Set Ds:Si Scrn Ptr
  816.                 Mov  Cl,Dh                      ;Count Box X_Num
  817.                 Push Dx                         ;Save X_Num,Y_Pos Ctr
  818. Copyclear2:     Cmp  Ah,0                       ;Protect Against Snow?
  819.                 Je   Copyclear7                 ;Jump Ahead If Not
  820.                 Mov  Dx,3Dah                    ;Status Byte Port Addr
  821. Copyclear3:     In   Al,Dx                      ;Get Status Byte
  822.                 Test Al,1                       ;Test Bit
  823.                 Jnz  Copyclear3                 ;Loop Till 0
  824.                 Cli                             ;Disable Interrupts
  825. Copyclear4:     In   Al,Dx                      ;Get Status Byte
  826.                 Test Al,1                       ;Test Bit
  827.                 Jz   Copyclear4                 ;Loop Till 1
  828.                 Movsw                           ;Transfer Word To Buffer
  829.                 Sub  Si,2                       ;Pull Back Screen Ptr
  830. Copyclear5:     In   Al,Dx                      ;Get Status Byte
  831.                 Test Al,1                       ;Test Bit
  832.                 Jnz  Copyclear5                 ;Loop Till 0
  833. Copyclear6:     In   Al,Dx                      ;Get Status Byte
  834.                 Test Al,1                       ;Test Bit
  835.                 Jz   Copyclear6                 ;Loop Till 1
  836.                 Mov  [Si],Bx                    ;Clear Cell On Screen
  837.                 Add  Si,2                       ;Move Scrn Ptr Back
  838.                 Jmp  Short Copyclear8           ;Jump Ahead
  839. Copyclear7:     Movsw                           ;Monochrome: Transf Char
  840.                 Mov  [Si-2],Bx                  ;Clear Screen Cell
  841. Copyclear8:     Loop Copyclear2                 ;Go Do Next
  842.                 Pop  Dx                         ;Restore X_Num,Y_Pos Ctrs
  843.                 Add  Bp,160                     ;Forward Ptr To Next Y_Pos
  844.                 Dec  Dl                         ;Dec Y_Pos Counter
  845.                 Jnz  Copyclear1                 ;Loop If Another Line
  846. Copyclear9:     Sti                             ;Reenable Interrupts
  847.                 Pop  Ds                         ;Restore Ds
  848.                 Pop  Bp                         ;Restore Bp
  849.                 Ret  14
  850. Copyclear Endp
  851.  
  852.  
  853. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  854. ;Procedure Swappage(Box: Pointer; Pagenumber: Byte);
  855. ;
  856. ;
  857. ;
  858. ;
  859. Swappage Proc Far
  860.                 Push Bp                         ;Save Bp
  861.                 Mov  Bp,Sp                      ;Set Stack Frame
  862.                 Push Ds                         ;Save Ds
  863.                 Mov  Bl,Snow_Check              ;Fetch Snow_Check
  864.                 Cld                             ;Set Direction Flag
  865.                 Mov  Cx,Video_Buff              ;Get Video Buffer Addr
  866.                 Mov  Dl,[Bp+6]                  ;Get Page Number
  867.                 Mov  Ax,1000H                   ;Page Size
  868.                 Mul  Dl                         ;Times Number Pages
  869.                 Add  Ax,Cx                      ;Add To Buffer Offset
  870.                 Mov  Es,Ax                      ;Es Pts To Page
  871.                 Lds  Si,Dword Ptr[Bp+8]         ;Ds:Si Pts To Byte Array
  872.                 Mov  Cx,2000                    ;Number Words To Exchange
  873.                 Sub  Di,Di                      ;Point Di To 0 Offset
  874.                 Cmp  Bl,0                       ;Snow_Check?
  875.                 Je   Swappagel1                 ;Jump If Not
  876.                 Mov  Dx,3D8H                    ;Cga Mode Select Register
  877.                 Mov  Al,25H                     ;Shuts Off Screen
  878.                 Out  Dx,Al                      ;Disable Video
  879. Swappagel1:     Mov  Ax,Es:[Di]                 ;Get Video Word
  880.                 Xchg Ax,[Si]                    ;Xchg With Word In Box
  881.                 Stosw                           ;Move Box Word To Screen
  882.                 Add  Si,2                       ;Forward Box Ptr
  883.                 Loop Swappagel1                 ;Go Do Next Word
  884.                 Cmp  Bl,0                       ;Snow Protect?
  885.                 Je   Swappagel2                 ;Jump Ahead If Not
  886.                 Mov  Dx,3D8H                    ;Cga Mode Select Register
  887.                 Mov  Al,41                      ;80X25, Blink Enabled
  888.                 Out  Dx,Al                      ;Reenable Video
  889. Swappagel2:     Pop  Ds                         ;Restore Ds
  890.                 Pop  Bp                         ;Restore Bp
  891.                 Ret  6
  892. Swappage Endp
  893.  
  894. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  895. ;Procedure Restorescreen(Box: Pointer; X_Pos,Y_Pos,X_Num,Y_Pos: Byte);
  896. ;
  897. ;
  898. ;
  899. ;
  900. Restorescreen Proc Far
  901.                 Push Bp                         ;Save Bp
  902.                 Mov  Bp,Sp                      ;Set Stack Frame
  903.                 Mov  Bl,Snow_Check              ;Grab Snow_Check
  904.                 Push Ds                         ;Save Ds
  905.                 Cld                             ;Set Direction Flag
  906.                 Mov  Ax,Video_Buff              ;Fetch Video Address
  907.                 Mov  Es,Ax                      ;Es Points To Screen
  908.                 Lds  Si,Dword Ptr[Bp+14]        ;Ds:Si Pts To Byte Array
  909.                 Mov  [Bp+14],Bl                 ;Save Snow_Check On Stack
  910.                 Sub  Ax,Ax                      ;
  911.                 Mov  Al,[Bp+10]                 ;Y_Pos In Ax
  912.                 Dec  Ax                         ;Count Y_Pos From 0
  913.                 Mov  Dl,160                     ;160 Bytes Per Y_Pos
  914.                 Mul  Dl                         ;Ax Times 160
  915.                 Sub  Dx,Dx                      ;
  916.                 Mov  Dl,[Bp+12]                 ;X_Pos In Dx
  917.                 Dec  Dx                         ;Count Cols From 0
  918.                 Shl  Dx,1                       ;Double For Attributes
  919.                 Add  Ax,Dx                      ;Offset Of Topleft Corner
  920.                 Mov  Bx,Ax                      ;Move Scrn Ptr To Bx
  921.                 Mov  Dh,[Bp+8]                  ;X_Num In Bx
  922.                 Mov  Dl,[Bp+6]                  ;Y_Pos In Dx
  923.                 Sub  Cx,Cx                      ;Clear Cx
  924. Restorescrl1:   Mov  Di,Bx                      ;Set Es:Di Scrn Ptr
  925.                 Mov  Cl,Dh                      ;X_Num Counter
  926.                 Push Dx                         ;Save X_Num,Y_Pos Ctrs
  927. Restorescrl2:   Cmp  Byte Ptr[Bp+14],0          ;Protect Against Snow?
  928.                 Je   Restorescrl5               ;Jump Ahead If Not
  929.                 Mov  Dx,3Dah                    ;Status Byte Address
  930. Restorescrl3:   In   Al,Dx                      ;Get Status Byte
  931.                 Test Al,1                       ;Test Bit
  932.                 Jnz  Restorescrl3               ;Loop Till 0
  933.                 Cli                             ;Disable Interrupts
  934. Restorescrl4:   In   Al,Dx                      ;Get Status Byte
  935.                 Test Al,1                       ;Test Bit
  936.                 Jz   Restorescrl4               ;Loop Till 1
  937. Restorescrl5:   Movsw                           ;Transfer Char To Scrn
  938.                 Loop Restorescrl2               ;Go Do Next In Y_Pos
  939.                 Pop  Dx                         ;Restore X_Num,Y_Pos Ctrs
  940.                 Add  Bx,160                     ;Forward Ptr To Next Y_Pos
  941.                 Dec  Dl                         ;Dec Y_Pos Counter
  942.                 Jnz  Restorescrl1               ;Loop If Another Line
  943. Restorescrl6:   Sti                             ;Reenable Interrupts
  944.                 Pop  Ds                         ;Restore Ds
  945.                 Pop  Bp                         ;Restore Bp
  946.                 Ret  12
  947. Restorescreen Endp
  948.  
  949.  
  950. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  951. ;Procedure Savescreen(Box: Pointer; X_Pos,Y_Pos,X_Num,Y_Pos: Byte);
  952. ;
  953. ;
  954. ;
  955. ;
  956. Savescreen Proc Far
  957.                 Push Bp                         ;Save Bp
  958.                 Mov  Bp,Sp                      ;Set Stack Frame
  959.                 Push Ds                         ;Ds Changed
  960.                 Mov  Bl,Snow_Check              ;Getch Snow_Check
  961.                 Mov  Ax,Video_Buff              ;Fetch Video Address
  962.                 Mov  Ds,Ax                      ;Ds Points To Buffer
  963.                 Les  Di,Dword Ptr[Bp+14]        ;Es:Di Pts To Box
  964.                 Sub  Ax,Ax                      ;
  965.                 Mov  Al,[Bp+10]                 ;Y_Pos In Ax
  966.                 Dec  Ax                         ;Count Y_Pos From 0
  967.                 Mov  Dl,160                     ;160 Bytes Per Y_Pos
  968.                 Mul  Dl                         ;Ax Times 160
  969.                 Sub  Dx,Dx                      ;
  970.                 Mov  Dl,[Bp+12]                 ;X_Pos In Dx
  971.                 Dec  Dx                         ;Count Cols From 0
  972.                 Shl  Dx,1                       ;Double For Attributes
  973.                 Add  Ax,Dx                      ;Offset Of Topleft Corner
  974.                 Mov  Dh,[Bp+8]                  ;X_Num To Dh
  975.                 Mov  Dl,[Bp+6]                  ;Y_Pos To Dl
  976.                 Sub  Cx,Cx                      ;Clear Cx
  977.                 Cld                             ;Set Direction Flag
  978. Savescrl1:      Mov  Si,Ax                      ;Set Ds:Si Scrn Ptr
  979.                 Mov  Cl,Dh                      ;X_Num Counter
  980.                 Push Dx                         ;Save X_Num, Y_Pos Ctrs
  981.                 Push Ax                         ;Save Line Start Ptr
  982. Savescrl2:      Or   Bl,Bl                      ;Protect Against Snow?
  983.                 Je   Savescrl5                  ;Jump Ahead If Not
  984.                 Mov  Dx,3Dah                    ;Status Byte Address
  985. Savescrl3:      In   Al,Dx                      ;Get Status Byte
  986.                 Test Al,1                       ;Test Bit
  987.                 Jnz  Savescrl3                  ;Loop Till 0
  988.                 Cli                             ;Disable Interrupts
  989. Savescrl4:      In   Al,Dx                      ;Get Status Byte
  990.                 Test Al,1                       ;Test Bit
  991.                 Jz   Savescrl4                  ;Loop Till 1
  992. Savescrl5:      Movsw                           ;Move Word To Buffer
  993.                 Loop Savescrl2                  ;Go Do Next In Y_Pos
  994.                 Pop  Ax                         ;Restore Line Start Ptr
  995.                 Pop  Dx                         ;Restore X_Num,Y_Pos Ctrs
  996.                 Add  Ax,160                     ;Forward Ptr To Next Y_Pos
  997.                 Dec  Dl                         ;Dec Y_Pos Counter
  998.                 Jnz  Savescrl1                  ;Loop If Another Line
  999. Savescrl6:      Sti                             ;Reenable Interrupts
  1000.                 Pop  Ds                         ;Restore Ds
  1001.                 Pop  Bp                         ;Restore Bp
  1002.                 Ret  12
  1003. Savescreen Endp
  1004.  
  1005.  
  1006. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1007. ;Procedure Scrollx(Where: Char; X_Pos,Y_Pos,X_Num,Y_Pos,Cols,Colour: Byte);
  1008. ;
  1009. ;
  1010. ;
  1011. ;
  1012. Scrollx Proc Far
  1013.                 Push Bp                         ;Save Bp
  1014.                 Mov  Bp,Sp                      ;Set Stack Frame
  1015.                 Push Ds                         ;Save Turbo'S Ds
  1016.                 Mov  Ax,Video_Buff              ;Fetch Video_Buff
  1017.                 Mov  Bl,Snow_Check              ;Get Snow_Check Before Change Ds
  1018.                 Mov  Es,Ax                      ;Move To Es
  1019.                 Mov  Ds,Ax                      ;Copy In Ds
  1020.                 Sub  Ax,Ax                      ;
  1021.                 Mov  Al,[Bp+14]                 ;Top Left Y_Pos To Ax
  1022.                 Mov  [Bp+14],Bl                 ;Save Snow_Check
  1023.                 Dec  Ax                         ;Count From 0
  1024.                 Cmp  Ax,24                      ;In Range?
  1025.                 Jna  Scrollxl2                  ;Jump Ahead If So
  1026. Scrollxl1:      Jmp  Scrollxl8                  ;Else Quit Routine
  1027. Scrollxl2:      Mov  Cl,160                     ;Bytes Per Y_Pos
  1028.                 Mul  Cl                         ;Times Y_Pos Count
  1029.                 Sub  Cx,Cx                      ;
  1030.                 Mov  Cl,[Bp+16]                 ;Top Left X_Pos To Cx
  1031.                 Dec  Cx                         ;Count From 0
  1032.                 Cmp  Cx,79                      ;In Range?
  1033.                 Ja   Scrollxl1                  ;Quit If Not
  1034.                 Shl  Cx,1                       ;Double For Attributes
  1035.                 Add  Ax,Cx                      ;Add To Y_Pos Offset
  1036.                 Sub  Dx,Dx                      ;
  1037.                 Mov  Dl,[Bp+10]                 ;Y_Pos To Dx
  1038.                 Or   Dx,Dx                      ;Test For Zero Length
  1039.                 Jz   Scrollxl1                  ;Quit If Zero
  1040.                 Mov  Cl,[Bp+18]                 ;Get Direction Flag
  1041.                 Cmp  Cl,'L'                     ;Test For 'L'
  1042.                 Je   Scrollxl3                  ;Jump Ahead If 'L'
  1043.                 Cmp  Cl,'L'                     ;Test For 'L'
  1044.                 Je   Scrollxl3                  ;Jump Ahead If 'L'
  1045.                 Sub  Cx,Cx                      ;
  1046.                 Mov  Cl,[Bp+12]                 ;X_Num To Cx
  1047.                 Dec  Cx                         ;Adjust
  1048.                 Shl  Cx,1                       ;Double For Attributes
  1049.                 Add  Ax,Cx                      ;Add To X,Y Position
  1050.                 Mov  Di,Ax                      ;Es:Di Pts To Top Right
  1051.                 Sub  Cx,Cx                      ;
  1052.                 Mov  Cl,[Bp+8]                  ;Get Cols To Scroll
  1053.                 Shl  Cx,1                       ;Double For Attributes
  1054.                 Sub  Ax,Cx                      ;Sub From Top Right Pos
  1055.                 Mov  Si,Ax                      ;Ds:Si Pts To Source
  1056.                 Std                             ;Set Direction For 'R'
  1057.                 Jmp  Short Scrollxl4            ;Jump Ahead
  1058. Scrollxl3:      Sub  Cx,Cx                      ;
  1059.                 Mov  Cl,[Bp+8]                  ;Cols To Cx
  1060.                 Shl  Cx,1                       ;Double For Attributes
  1061.                 Mov  Di,Ax                      ;Es:Di Pts Leftmost Char
  1062.                 Add  Ax,Cx                      ;Offset To Lst Scrl Char
  1063.                 Mov  Si,Ax                      ;Ds:Si Pts Scrl Char
  1064.                 Cld                             ;Set Direction For 'L'
  1065. Scrollxl4:      Sub  Cx,Cx                      ;
  1066.                 Mov  Cl,[Bp+12]                 ;Box X_Num To Dx
  1067.                 Or   Cx,Cx                      ;Test For Zero X_Num
  1068.                 Jz   Scrollxl8                  ;Quit Routine If Zero
  1069.                 Sub  Ax,Ax                      ;
  1070.                 Mov  Al,[Bp+8]                  ;Number Cols To Scroll
  1071.                 Or   Ax,Ax                      ;Test For Zero Cols
  1072.                 Jnz  Scrollxl5                  ;Jump Ahead If Not Zero
  1073.                 Xchg Ax,Cx                      ;Else Cols = X_Num
  1074.                 Jmp  Short Scrollxl6            ;Jump Ahead
  1075. Scrollxl5:      Sub  Cx,Ax                      ;X_Num Minus Cols
  1076.                 Cmp  Cx,0                       ;More Cols Than X_Num?
  1077.                 Jge  Scrollxl6                  ;Jump Ahead If Not
  1078.                 Sub  Ax,Ax                      ;
  1079.                 Mov  Al,[Bp+12]                 ;Else Cols = X_Num
  1080.                 Mov  Cx,0                       ;Scroll = 0
  1081. Scrollxl6:      Push Ax                         ;Save Number Cols
  1082.                 Push Cx                         ;Save X_Num Counter
  1083.                 Push Si                         ;Save Source Ptr
  1084.                 Push Di                         ;Save Destination Ptr
  1085.                 Push Dx                         ;Save Y_Pos Counter
  1086.                 Push Ax                         ;Save Number Cols
  1087.                 Cmp  Byte Ptr[Bp+14],0          ;Protect Against Snow?
  1088.                 Je   Scrollxl7                  ;Jump Ahead If Not
  1089.                 Mov  Dx,3D8H                    ;Cga Mode Select Register
  1090.                 Mov  Al,25H                     ;Shut Off Screen
  1091.                 Out  Dx,Al                      ;Do It
  1092. Scrollxl7:      Pop  Ax                         ;Restore Number Cols
  1093.                 Pop  Dx                         ;Restore Y_Pos Counter
  1094.                 Rep  Movsw                      ;Move A Y_Pos
  1095.                 Mov  Cx,Ax                      ;Number Cols Scrolled
  1096.                 Mov  Al,32                      ;Clear With Spc Char
  1097.                 Mov  Ah,[Bp+6]                  ;Attribute For Clear
  1098.                 Rep  Stosw                      ;Clear Opened Area
  1099.                 Pop  Di                         ;Restore Destination Ptr
  1100.                 Add  Di,160                     ;Forward To Next Line
  1101.                 Pop  Si                         ;Restore Source Ptr
  1102.                 Add  Si,160                     ;Forward To Next Line
  1103.                 Pop  Cx                         ;Restore X_Num Counter
  1104.                 Pop  Ax                         ;Restore Num Cols
  1105.                 Dec  Dx                         ;Dec The Y_Pos Counter
  1106.                 Jnz  Scrollxl6                  ;Loop Until Finished
  1107.                 Cmp  Byte Ptr[Bp+14],0          ;Protected Against Snow?
  1108.                 Je   Scrollxl8                  ;Jump If Not
  1109.                 Mov  Dx,3D8H                    ;Cga Mode Select Register
  1110.                 Mov  Al,41                      ;80X25, Blink Enabled
  1111.                 Out  Dx,Al                      ;Reenable Video
  1112. Scrollxl8:      Pop  Ds                         ;Restore Ds
  1113.                 Pop  Bp                         ;Restore Bp
  1114.                 Ret  14
  1115. Scrollx Endp
  1116.  
  1117. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1118. ;Procedure Scrolly(Where: Char; X_Pos,Y_Pos,X_Num,Y_Num,Lines,Colour: Byte);
  1119. ;
  1120. ;
  1121. ;
  1122. ;
  1123. Scrolly Proc Far
  1124.                 Push Bp                         ;Save Bp
  1125.                 Mov  Bp,Sp                      ;Set Stack Frame
  1126.                 Mov  Ah,7                       ;Assume Downward Scroll
  1127.                 Mov  Al,[Bp+18]                 ;Get Direction Code
  1128.                 Cmp  Al,'D'                     ;Downward Scroll?
  1129.                 Je   Scrollyl1                  ;Jump Ahead If So
  1130.                 Cmp  Al,'D'                     ;Downward Scroll?
  1131.                 Je   Scrollyl1                  ;Jump Ahead If So
  1132.                 Mov  Ah,6                       ;Else Code To Scroll Up
  1133. Scrollyl1:      Mov  Cl,[Bp+16]                 ;Top Left X_Pos In Cl
  1134.                 Dec  Cl                         ;Count From 0
  1135.                 Mov  Ch,[Bp+14]                 ;Top Left Y_Pos In Ch
  1136.                 Dec  Ch                         ;Count From 0
  1137.                 Mov  Dl,[Bp+12]                 ;X_Num In Dl
  1138.                 Dec  Dl                         ;Adjust
  1139.                 Add  Dl,Cl                      ;Bottom Right X_Pos In Dl
  1140.                 Mov  Dh,[Bp+10]                 ;Y_Pos In Dh
  1141.                 Dec  Dh                         ;Adjust
  1142.                 Add  Dh,Ch                      ;Bottom Right Y_Pos In Dh
  1143.                 Mov  Al,[Bp+8]                  ;Number Lines In Al
  1144.                 Mov  Bh,[Bp+6]                  ;Fill Attribute
  1145.                 Int  10H                        ;Make The Scroll
  1146.                 Pop  Bp                         ;Restore Bp And Quit
  1147.                 Ret  14
  1148. Scrolly Endp
  1149.  
  1150.  
  1151. ; Code Ends
  1152.  
  1153. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1154. ;                 Local Procedures Used By Other Procedures
  1155. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1156.  
  1157. Boxd_Screen Proc
  1158.                 Push Dx                         ;Save Dx
  1159.                 Push Ax                         ;Save Ax
  1160.                 Mov  Dx,3Dah                    ;Status Byte Address
  1161.                 Mov  Bx,Es                      ;Get Target Segment
  1162.                 Mov  Ax,Ds                      ;Get Source Segment
  1163.                 Cmp  Ax,Bx                      ;Is Source Larger?
  1164.                 Jna  Boxdscra1                  ;Jump If Not
  1165.                 Mov  Bx,Ax                      ;Else Use Source
  1166. Boxdscra1:      Cmp  Byte Ptr[Bp+16],0          ;Protect Against Snow?
  1167.                 Je   Boxdscrd1                  ;Jump Ahead If Not
  1168. Boxdscrb1:      In   Al,Dx                      ;Get Status Byte
  1169.                 Test Al,1                       ;Test Bit
  1170.                 Jnz  Boxdscrb1                  ;Loop Till 0
  1171.                 Cli                             ;Disable Interrupts
  1172. Boxdscrc1:      In   Al,Dx                      ;Get Status Byte
  1173.                 Test Al,1                       ;Test Bit
  1174.                 Jz   Boxdscrc1                  ;Loop Till 1
  1175. Boxdscrd1:      Movsb                           ;Move A Character
  1176.                 Loop Boxdscra1                  ;Go Do Next
  1177.                 Pop  Ax                         ;Restore Ax
  1178.                 Pop  Dx                         ;Restore Dx
  1179.                 Ret                             ;
  1180. Boxd_Screen Endp
  1181.  
  1182. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1183. Boxl_Screen Proc
  1184.                 Push Dx                         ;Save Dx
  1185.                 Push Ax                         ;Save Ax Too
  1186.                 Mov  Dx,Es                      ;Get Target Segment
  1187.                 Mov  Ax,Ds                      ;Get Source Segment
  1188.                 Cmp  Ax,Dx                      ;Is Source Larger?
  1189.                 Jna  Boxlscra1                  ;Jump If Not
  1190.                 Mov  Dx,Ax                      ;Else Use Source
  1191. Boxlscra1:      Cmp  Byte Ptr[Bp+16],0          ;Protect Against Snow?
  1192.                 Je   Boxlscrf1                  ;Jump Ahead If Not
  1193.                 Mov  Dx,3Dah                    ;Status Byte Address
  1194. Boxlscrb1:      In   Al,Dx                      ;Get Status Byte
  1195.                 Test Al,1                       ;Test Bit
  1196.                 Jnz  Boxlscrb1                  ;Loop Till 0
  1197.                 Cli                             ;Disable Interrupts
  1198. Boxlscrc1:      In   Al,Dx                      ;Get Status Byte
  1199.                 Test Al,1                       ;Test Bit
  1200.                 Jz   Boxlscrc1                  ;Loop Till 1
  1201.                 Movsb                           ;Write A Char
  1202. Boxlscrd1:      In   Al,Dx                      ;Get Status Byte
  1203.                 Test Al,1                       ;Test Bit
  1204.                 Jnz  Boxlscrd1                  ;Loop Till 0
  1205. Boxlscre1:      In   Al,Dx                      ;Get Status Byte
  1206.                 Test Al,1                       ;Test Bit
  1207.                 Jz   Boxlscre1                  ;Loop Till 1
  1208.                 Movsb                           ;Write A Char
  1209.                 Jmp  Short Boxlscrg1            ;Jump Ahead And Quit
  1210. Boxlscrf1:      Movsw                           ;Move The Character
  1211. Boxlscrg1:      Pop  Ax                         ;Restore Ax
  1212.                 Pop  Dx                         ;Restore Dx
  1213.                 Ret                             ;
  1214. Boxl_Screen Endp
  1215.  
  1216. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1217. Boxr_Screen Proc
  1218.                 Push Dx                         ;Save Dx
  1219.                 Push Bx                         ;Save Bx
  1220.                 Push Ax                         ;Save Ax
  1221.                 Mov  Dx,Es                      ;Get Target Segment
  1222.                 Mov  Ax,Ds                      ;Get Source Segment
  1223.                 Cmp  Ax,Dx                      ;Is Source Larger?
  1224.                 Jna  Boxriscra1                 ;Jump If Not
  1225.                 Mov  Dx,Ax                      ;Else Use Source
  1226. Boxriscra1:     Cmp  Bl,0                       ;Protect Against Snow?
  1227.                 Je   Boxriscrf1                 ;Jump Ahead If Not
  1228.                 Mov  Dx,3Dah                    ;Status Byte Address
  1229. Boxriscrb1:     In   Al,Dx                      ;Get Status Byte
  1230.                 Test Al,1                       ;Test Bit
  1231.                 Jnz  Boxriscrb1                 ;Loop Till 0
  1232. Boxriscrc1:     In   Al,Dx                      ;Get Status Byte
  1233.                 Test Al,1                       ;Test Bit
  1234.                 Jz   Boxriscrc1                 ;Loop Till 1
  1235.                 Movsb                           ;Move A Character
  1236. Boxriscrd1:     In   Al,Dx                      ;Get Status Byte
  1237.                 Test Al,1                       ;Test Bit
  1238.                 Jnz  Boxriscrd1                 ;Loop Till 0
  1239. Boxriscre1:     In   Al,Dx                      ;Get Status Byte
  1240.                 Test Al,1                       ;Test Bit
  1241.                 Jz   Boxriscre1                 ;Loop Till 1
  1242.                 Movsb                           ;Move A Character
  1243.                 Jmp  Short Boxriscrg1           ;Jump Ahead And Quit
  1244. Boxriscrf1:     Movsw                           ;Move The Character
  1245. Boxriscrg1:     Pop  Ax                         ;Restore Ax
  1246.                 Pop  Bx                         ;Restore Bx
  1247.                 Pop  Dx                         ;Restore Dx
  1248.                 Ret                             ;
  1249. Boxr_Screen Endp
  1250.  
  1251. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1252. Boxu_Screen  Proc
  1253.                 Push Dx                         ;Save Dx
  1254.                 Push Ax                         ;Save Ax
  1255.                 Mov  Dx,3Dah                    ;Status Byte Address
  1256.                 Mov  Bx,Es                      ;Get Target Segment
  1257.                 Mov  Ax,Ds                      ;Get Source Segment
  1258.                 Cmp  Ax,Bx                      ;Is Source Larger?
  1259.                 Jna  Boxuscra1                  ;Jump If Not
  1260.                 Mov  Bx,Ax                      ;Else Use Source
  1261. Boxuscra1:      Cmp  Byte Ptr[Bp+16],0          ;Protect Against Snow?
  1262.                 Je   Boxuscrd1                  ;Jump Ahead If Not
  1263. Boxuscrb1:      In   Al,Dx                      ;Get Status Byte
  1264.                 Test Al,1                       ;Test Bit
  1265.                 Jnz  Boxuscrb1                  ;Loop Till 0
  1266.                 Cli                             ;Disable Interrupts
  1267. Boxuscrc1:      In   Al,Dx                      ;Get Status Byte
  1268.                 Test Al,1                       ;Test Bit
  1269.                 Jz   Boxuscrc1                  ;Loop Till 1
  1270. Boxuscrd1:      Movsb                           ;Move A Character
  1271.                 Loop Boxuscra1                  ;Go Do Next
  1272.                 Pop  Ax                         ;Restore Ax
  1273.                 Pop  Dx                         ;Restore Dx
  1274.                 Ret                             ;
  1275. Boxu_Screen  Endp
  1276.  
  1277. ;=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  1278. Drawb_Screen Proc                               ;Procedures Writes Char,
  1279.                 Push Dx                         ;Fix Snow
  1280.                 Push Bx                         ;Save Dx And Bx
  1281.                 Cld                             ;Set Direction Flag
  1282.                 Cmp  Snow_Check,0               ;Protect Against Snow?
  1283.                 Je   Dboxscrc1                  ;Jump Ahead If Not
  1284.                 Mov  Dx,3Dah                    ;Status Byte Address
  1285.                 Mov  Bx,Ax                      ;Store Ax Contents
  1286. Dboxscra1:      In   Al,Dx                      ;Get Status Byte
  1287.                 Test Al,1                       ;Test Bit
  1288.                 Jnz  Dboxscra1                  ;Loop Till 0
  1289.                 Cli                             ;Disable Interrupts
  1290. Dboxscrb1:      In   Al,Dx                      ;Get Status Byte
  1291.                 Test Al,1                       ;Test Bit
  1292.                 Jz   Dboxscrb1                  ;Loop Till 1
  1293.                 Mov  Ax,Bx                      ;Restore Ax Contents
  1294. Dboxscrc1:      Stosw                           ;Write The Character
  1295.                 Dec  Di                         ;Pull Ptr Back
  1296.                 Dec  Di                         ;Again
  1297.                 Pop  Bx                         ;Restore Bx
  1298.                 Pop  Dx                         ;Restore Dx And Return
  1299.                 Ret
  1300. Drawb_Screen    Endp
  1301.  
  1302.  
  1303. Code Ends
  1304.  
  1305. End
  1306.  
  1307.  
  1308.